# Created by 黄景涛
# DATE: 2025/2/25
import requests
from 蓝鲸各saas登录方案.V4.saas_login import SmartLogin, InnerLogin
from 蓝鲸各saas登录方案.V4.config.settings import cfg

if __name__ == '__main__':
    login_url = cfg.get('login_url')
    username = cfg.get('username')
    password = cfg.get('password')
    saas_name = cfg.get('smart_saas')
    cookies = SmartLogin(login_url, username, password, saas_name).login()

    esmv40_api = "http://paas.test.com/o/esmv40_saas/core/api/v2/user_manage/get_login_user_info/"
    response = requests.get(esmv40_api, cookies=cookies, verify=False)
    print(response.json())

    # =================================================================================================
    saas_name = cfg.get('inner_saas')
    cookies = InnerLogin(login_url, username, password, saas_name).login()
    cmdb_api = "http://cmdb.test.com/api/v3/admin/find/system_config/platform_setting/current"
    response = requests.get(cmdb_api, cookies=cookies, verify=False)
    print(response.json())
    